#define _CRT_SECURE_NO_WARNINGS
#include"SList.h"

void SLTPrint(SLTNode* phead)
{
	SLTNode* cur = phead;
	while (cur != NULL)
	{
		printf("%d ", cur->data);
		cur=cur->next;
	}
}

void SLPushBack(SLTNode* phead)
{
	SLTNode *cur= (SLTNode*)malloc(sizeof(SLTNode));
	if (cur == NULL)
	{
		perror("SLPushBack:");
		return;
	}
	phead->next = cur;
	cur->data = 0;
}

void SLPushFront(SLTNode** phead, SListDataType x)
{
	SLTNode*newnode= (SLTNode*)malloc(sizeof(SLTNode));
	if (newnode == NULL)
	{
		perror("SLPushFront:");
		return;
	}
	newnode->data = x;
	newnode->next = NULL;

	newnode->next = phead;
	*phead = newnode;
}

